#import<iostream>
#import<string>
#import<vector>

using namespace std;

#import "GArete.h"

template <class G, class S, class A>
GArete<G, S, A>::GArete(string nom, G* graphe, S* fstSommet, S* sndSommet){
	this->graphe = graphe;
	this->fstSommet = fstSommet;
	this->fstSommet->addArete(static_cast<A* >(this));
	this->sndSommet = sndSommet;
	this->sndSommet->addArete(static_cast<A *>(this));
	this->nom = nom;
}

template <class G, class S, class A>
GArete<G, S, A>::~GArete(){

}


template <class G, class S, class A>
void GArete<G, S, A>::deleteArete(){
	fstSommet->removeArete(static_cast<A *>(this));
	sndSommet->removeArete(static_cast<A *>(this));
	graphe->removeArete(static_cast<A *>(this));
	//delete this;
}

//########################################################################

template <class G, class S, class A>
string GArete<G, S, A>::getNom(){
	return nom;
}

template <class G, class S, class A>
string GArete<G, S, A>::toStringComplet(){
	string s = toString();
	s += "\n#" + graphe->toString();
	s += "\n*" + fstSommet->toString();
	s += "\n*" + sndSommet->toString() +"\n";
	return s;
}


//########################################################################

template <class G, class S, class A>
G* GArete<G, S, A>::getGraphe(){
	return graphe;
}

//########################################################################

template <class G, class S, class A>
void GArete<G, S, A>::setFstSommet(S * fstSommet){
	this->fstSommet->removeArete(static_cast<A *>(this));
	this->fstSommet = fstSommet;
	this->fstSommet->addArete(static_cast<A *>(this));
}

template <class G, class S, class A>
S * GArete<G, S, A>::getFstSommet(){
	return this->fstSommet;
}

template <class G, class S, class A>
void GArete<G, S, A>::setSndSommet(S * sndSommet){
	this->sndSommet->removeArete(static_cast<A *>(this));
	this->sndSommet = sndSommet;
	this->sndSommet->addArete(static_cast<A *>(this));
}

template <class G, class S, class A>
S * GArete<G, S, A>::getSndSommet(){
	return sndSommet;
}
